package alo.p5.work;

import java.util.Queue;
import java.util.Stack;
//逆置队列
public class QueueReversal {
    public Queue reversaQueue(Queue queue){
        Stack stack=new Stack();
        while (!queue.isEmpty()){
            stack.push(queue.poll());
        }
        while (!stack.isEmpty()){
            queue.offer(stack.pop());
        }
        return queue;
    }
}
